#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
邮箱配置文件
自动生成于 2025-09-20 10:57:28
"""

# ==================== 邮箱配置 ====================

# 发送邮箱配置
SENDER_EMAIL = "505735255@qq.com"
SENDER_PASSWORD = "********"

# 接收邮箱配置
RECIPIENT_EMAIL = "505735255@qq.com"

# ==================== RSS配置 ====================

# RSS新闻源地址
RSS_URL = "https://rss.aishort.top/?type=36kr"

# ==================== 定时任务配置 ====================

# 发送时间 (24小时制，格式: HH:MM)
SEND_TIME = "11:00"

# 最大新闻条目数
MAX_NEWS_ITEMS = 8

# ==================== 其他配置 ====================

# 是否启用日志记录
ENABLE_LOGGING = True

# 日志文件目录
LOG_DIR = "logs"

# 是否在发送失败时重试
ENABLE_RETRY = True

# 重试次数
MAX_RETRY_COUNT = 3

# 重试间隔（秒）
RETRY_INTERVAL = 300  # 5分钟


def validate_config():
    """验证配置是否完整"""
    errors = []
    
    if not SENDER_EMAIL:
        errors.append("请设置发送邮箱地址")
    
    if not SENDER_PASSWORD:
        errors.append("请设置邮箱授权码")
    
    if not RECIPIENT_EMAIL:
        errors.append("请设置接收邮箱地址")
    
    if not RSS_URL:
        errors.append("请设置RSS源地址")
    
    if not SEND_TIME:
        errors.append("请设置发送时间")
    
    return errors


def get_config_info():
    """获取配置信息摘要"""
    return {
        "sender_email": SENDER_EMAIL,
        "recipient_email": RECIPIENT_EMAIL,
        "rss_url": RSS_URL,
        "send_time": SEND_TIME,
        "max_news_items": MAX_NEWS_ITEMS,
        "config_valid": len(validate_config()) == 0
    }


if __name__ == "__main__":
    # 配置验证
    errors = validate_config()
    
    if errors:
        print("❌ 配置验证失败:")
        for error in errors:
            print(f"  - {error}")
        print("\n请修改 email_config.py 文件中的配置")
    else:
        print("✅ 配置验证通过")
        print("\n当前配置:")
        info = get_config_info()
        for key, value in info.items():
            if key != "config_valid":
                print(f"  {key}: {value}")
